home *** CD-ROM | disk | FTP | other *** search
- /*******************************************\
- * file: BeginReport.c *
- * version: 0.1ß *
- * XCMD ID 500 *
- * *
- * Opens access to the printer for the *
- * current report. *
- * *
- * Returns True if the user clicks ok in the *
- * job dialog, false otherwise. *
- * ----------------------------------------- *
- * By: Donald Koscheka *
- * Date: 30-OCT-89 *
- * © Copyright 1989, Donald Koscheka *
- * All Rights Reserved *
- * *
- * ----------------------------------------- *
- \*******************************************/
-
- #include <MacTypes.h>
- #include <MemoryMgr.h>
- #include <ResourceMgr.h>
- #include <OSUtil.h>
- #include <HyperXCmd.h>
- #include <HyperUtils.h>
- #include <PrintMgr.h>
- #include "ReportUtils.h"
-
-
-
-
- pascal void main( paramPtr )
- XCmdBlockPtr paramPtr;
- /**********************************
- * we allocate the page information
- * record as a resource so that
- * subsequent xcmds will be able to
- * find the data using getresource()
- *
- *
- * allocate the resource in the system
- * resource fork.
- **********************************/
- {
- Handle pH;
- pInfoPtr pp;
- TPPrPort tp;
- short oldRes;
- THPrint printRec;
- Handle result;
-
- if( !(pH = GetSystemResource( PAGE_INFO, PAGE_ID )) ){
- if( pH = NewSysHandle( (long)sizeof( pInfo ) ) ){
- PrOpen();
-
- if( printRec = (THPrint)NewHandle( (long)sizeof(TPrint) ) ){
- PrintDefault( printRec );
-
- if( PrJobDialog( printRec ) ){
-
- AddSystemResource( pH, (ResType)PAGE_INFO, PAGE_ID,
- "\p page information record" );
-
- pp = (pInfoPtr)*pH;
- pp->prRecHandle = printRec;
-
- tp = PrOpenDoc( pp->prRecHandle, NIL, NIL );
-
- pp->prPort = (GrafPtr)tp;
- PrOpenPage( tp, NIL );
-
- pp->curntPen.v = pp->curntPen.h = 0;
-
- pp->pagecount = 1; /*** for printing on bottom of page ***/
- pp->totalpages = 0; /*** for resetting the document. ***/
- pp->footNote.key1 = NIL;
- pp->footNote.key2 = NIL;
- pp->footNote.key3 = NIL;
- pp->footNote.hite = 0;
-
- SetMargin( pp, 0, 0, 0, 0 );
-
- SetFont( (stylePtr)&(pp->curntStyle), DEFAULT_FONT );
- SetFontSize( (stylePtr)&(pp->curntStyle), DEFAULT_SIZE );
- SetFontStyle( (stylePtr)&(pp->curntStyle), PLAIN_TEXT );
- SetFontJust( (stylePtr)&(pp->curntStyle), teJustLeft );
-
- SetFont( (stylePtr)&(pp->defaultStyle), DEFAULT_FONT );
- SetFontSize( (stylePtr)&(pp->defaultStyle), DEFAULT_SIZE );
- SetFontStyle( (stylePtr)&(pp->defaultStyle), PLAIN_TEXT );
- SetFontJust( (stylePtr)&(pp->defaultStyle), teJustLeft );
-
- result = PasToZero( paramPtr, "\pTRUE");
- }/* if job dialog */
- else{
- TrashHandle( (Handle)printRec );
- TrashHandle( (Handle)pH );
- result = PasToZero( paramPtr, "\pFALSE");
- }/* else */
- }/* if printRec */
- }/* if pH allocated */
- }/* if pH not previously allocated */
-
- paramPtr->returnValue = result;
-
- }
-
-
-
-
-